/*
 * @Author: lg
 * @Date: 2024-02-28 09:13:39
 * @LastEditors: lg
 * @LastEditTime: 2024-03-01 13:58:06
 * @Description: 
 * @FilePath: \stell-mall\vite.config.ts
 */
import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'path';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    outDir: 'dist', // 输出目录
    assetsDir: 'stell-mall', // 静态资源目录
    rollupOptions: {

    },
    base: './', // 设置打包后 index.html 中引用资源的基本路径
  },
  plugins: [
    vue(),
    //svg图标
    createSvgIconsPlugin({
      // Specify the icon folder to be cached
      iconDirs: [resolve(process.cwd(), 'src/assets/svgs')],
      // Specify symbolId format
      symbolId: 'icon-[dir]-[name]'
    }),
  ],
  resolve: {
    extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
    alias: {
      '@': `${resolve(__dirname, 'src')}/`
    }
  },
  server: {
    host: '0.0.0.0'
  }
})
